<%@ page import="java.util.LinkedList, model.Contact" language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<jsp:useBean id="subject" scope="request" type="model.subjects.Subject"/>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Kontaktid</title>
</head>
<body>
<div id="contacts">
<h1>Kontaktid</h1>

<%
LinkedList<Contact> contacts = subject.getContacts();
for(Contact c: contacts){
	out.println("<div class=\"contact\">");
	int contactType = c.getContactType();
	String valueLabel ="";
	String tagName = "";
	if(contactType == 1){
		valueLabel = "e-mail";
		tagName = "email";
	}else if (contactType == 2){
		valueLabel = "telefoninumber";
		tagName = "phone";
	}
	out.println("<label>"+valueLabel+": </label><input name=\""+tagName+"\" value=\"" + c.getValue()+"\"><br/>");
	out.println("<label>Lisainfo: </label><input name=\"contact_note\" value=\"" + c.getContactNote()+"\"><br/>");
	out.println("</div><br/>");
}

%>
<input type="submit" value="Muuda"><input type="button" value="Lisa uus kontakt">
</div>
</body>
</html>